#include <iostream>
#include <thread>
#include <functional>
using namespace std;

void threadFunc(int x)
{
  cout << "Child id = " << this_thread::get_id() << endl;
  cout << "bind(threadFunc)()" << endl;
  cout << "x = " << x << endl;
};

int main()
{
  cout << "Main id = " << this_thread::get_id() << endl;

  using namespace placeholders;
  thread th(bind(threadFunc, _2), 8, 9); // 线程入口函数可以传递bind的返回结果

  cout << "Child id = " << th.get_id() << endl;
  th.join(); // 主线程等待子线程执行结束
  return 0;
}